function saveData() {
	var form = baseJs.getForm("addForm");
	if (!form.isVal()) {
		alert("请按要求填写数据！");
		return;
	}
	$.post(host + "tableAction/saveField.html", form.getItems(), function(data) {
		if (data.status == "ok") {
			baseJs.getOpenWindow().alert(data.msg);
			baseJs.getOpenWindow().datagrid.datagrid('reload');
			baseJs.getOpenWindow().dialog.close();
		} else {
			alert(data.msg);
		}
	}, "json");
}
$(function() {
	var id = baseJs.request("id");
	if (id) {
		$("#id").val(id);
		$.post(host + "tableAction/getFieldInfoById.html", {id: id}, function(data) {
			if (data.status == "error") {
				alert(data.msg);
			} else {
				data = data.data;
				for (var key in data) {
					$("#" + key).val(data[key]);
				}
			}
		}, "json");
	} else {
		$("#tableId").val(baseJs.request("tableId"));
	}
});
function changeType(value) {
	$("#fixed").attr("disabled", value != "float");
}
function closeWin() {
	baseJs.getOpenWindow().dialog.close();
}